package com.dragoncombin.homework.Problem03;

// 通话套餐类
public class CallingPackage extends  AbstractPackage implements CallingServiceInterface{

    // 特征：通话时长、短信条数、每月资费
    private int callDuration;
    private int smsAmount;

    // 分别自定义无参和有参构造方法
    public CallingPackage() {
    }

    public CallingPackage(int callDuration, int smsAmount, int chargePerMonth) {
        setCallDuration(callDuration);
        setSmsAmount(smsAmount);
        setChargePerMonth(chargePerMonth);
    }

    public int getCallDuration() {
        return callDuration;
    }

    public void setCallDuration(int callDuration) {
        this.callDuration = callDuration;
    }

    public int getSmsAmount() {
        return smsAmount;
    }

    public void setSmsAmount(int smsAmount) {
        this.smsAmount = smsAmount;
    }


    // 行为：显示所有套餐信息
    public void show() {
        System.out.println("通话时长: " + getCallDuration() + " 分钟");
        System.out.println("短信条数: " + getSmsAmount() + " 条");
        System.out.println("每月资费: " + getChargePerMonth() + " 元");
    }

    @Override
    public void service(int callDuration, PhoneCard phoneCard) {
        phoneCard.setCallDuration(phoneCard.getCallDuration() + callDuration);
        System.out.println("卡号: " + phoneCard.getCardId() + "的机主 " + phoneCard.getUserName() + " 通话 " + callDuration + " 分钟");
    }
}
